package com.tencent.mm.opensdk.utils;

import android.os.Bundle;

import java.security.MessageDigest;

public class TecentUtil {
    public static boolean isEmpty(String paramString)
    {
        return (paramString == null) || (paramString.length() <= 0);
    }

    public static int s2i(String paramString)
    {
        try
        {
            if ((paramString == null) || (paramString.length() <= 0)) {
                return 0;
            }
            return Integer.parseInt(paramString);
        }
        catch (Exception localException) {}
        return 0;
    }


    public static final String md5(byte[] paramArrayOfByte)
    {
        char[] arrayOfChar1 = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' };
        try
        {
            MessageDigest localMessageDigest;
            (localMessageDigest = MessageDigest.getInstance("MD5")).update(paramArrayOfByte);
            int i;
            char[] arrayOfChar2 = new char[(i = (paramArrayOfByte = localMessageDigest.digest()).length) * 2];
            int j = 0;
            for (int k = 0; k < i; k++)
            {
                int m = paramArrayOfByte[k];
                arrayOfChar2[(j++)] = arrayOfChar1[(m >>> 4 & 0xF)];
                arrayOfChar2[(j++)] = arrayOfChar1[(m & 0xF)];
            }
            return new String(arrayOfChar2);
        }
        catch (Exception localException) {}
        return null;
    }






    public static int getIFromBundle(Bundle paramBundle, String paramString)
    {
        if (paramBundle == null) {
            return -1;
        }
        int flag=0;
        try
        {
            flag=paramBundle.getInt(paramString, -1);;

        }
        catch (Exception e)
        {
            Log.e("MicroMsg.IntentUtil", "getIntExtra exception:" + e.getMessage());
            flag = -1;
        }
        return flag;
    }

    public static String getSFromBundle(Bundle paramBundle, String paramString)
    {
        if (paramBundle == null) {
            return null;
        }


        String value="";

        try
        {
            value = paramBundle.getString(paramString);
        }
        catch (Exception e)
        {
            Log.e("MicroMsg.IntentUtil", "getStringExtra exception:" + e.getMessage());
            paramBundle = null;
        }
        return value;
    }






}
